#pragma once
#include <iostream>
#include <vector>
#include <functional>
#include <ctime>
#include <cstdlib>
using namespace std;
void PrintLog()
{
    std::cout << "我是一个打印日志的任务" << std::endl;
}

void Download()
{
    std::cout << "我是一个下载的任务" << std::endl;
}

void Upload()
{
    std::cout << "我是一个上传的任务" << std::endl;
}
class TaskManage
{
public:
    TaskManage()
    {
        srand((unsigned int)time(nullptr));
    }
    void InsertTask(void(*fun)())
    {
        _tasks.push_back(fun);
    }
    int GetCode()
    {
        return rand()%_tasks.size();
    }
    void ExeTask(int code)
    {
        _tasks[code]();
    }
    ~TaskManage()
    {}
private:
    vector<function<void()>> _tasks;
};